/*****************************************************************************
 * socket_modem.c
 *
 * Copyright (C) 2020 Jeasonvor 1101627719@qq.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 ****************************************************************************/

/*****************************************************************************
 * Included Files
 ****************************************************************************/
#include "plum_api.h"
/*****************************************************************************
 * Trace Definitions
 ****************************************************************************/
#define LOG_RUN_LEVEL LOG_LEVEL_INFO
#define LOG_MODULE    "tcp.modem"

/*****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

#define DEV_AT_CAT1_AIR720  "air720"
#define DEV_AT_NBIOT_ME3616 "me3616"
#define DEV_AT_NBIOT_M5311  "m5311"
#define DEV_AT_WIFI_ESP32   "esp32"
#define DEV_AT_UNKOWN       "unkown"

#if (CONFIG_CAT1_AIR720_ENABLE)
#define CAL_SOCKET_MODEM DEV_AT_CAT1_AIR720
#elif (CONFIG_NBIOT_ME3616_ENABLE)
#define CAL_SOCKET_MODEM DEV_AT_NBIOT_ME3616
#elif (CONFIG_NBIOT_M5311_ENABLE)
#define CAL_SOCKET_MODEM DEV_AT_NBIOT_M5311
#elif (CONFIG_DEV_AT_WIFI_ESP32)
#define CAL_SOCKET_MODEM DEV_AT_WIFI_ESP32
#else
#error "plese choice device for modem"
#define CAL_SOCKET_MODEM DEV_AT_UNKOWN
#endif
/*****************************************************************************
 * Private Types
 ****************************************************************************/

/*****************************************************************************
 * Private Function Prototypes
 ****************************************************************************/

/*****************************************************************************
 * Private Data
 ****************************************************************************/

/*****************************************************************************
 * Public Data
 ****************************************************************************/

/*****************************************************************************
 * Private Functions
 ****************************************************************************/

/*****************************************************************************
 * Public Functions
 ****************************************************************************/
PLUM_PUBLIC
plum_s32 plum_cal_socket(plum_socketaddr_family_t family,
                         plum_socket_type_t type, plum_s32 protocol)
{
    plum_s32 rc = PLUM_ECODE_OK;

    do {
        plum_tcpip_ioctl_socekt_t sock;
        rc = plum_device_ioctrl(CAL_SOCKET_MODEM, PLUM_TCPIP_IOCTL_SOCKET,
                                &sock);
        if (rc) {
            LOG_E("plum_device_ioctrl err,rc : %d", rc);
            break;
        }
    } while (0);

    return (rc);
}
/****************************************************************************/
/*                                                                          */
/*  End of file.                                                            */
/*                                                                          */
/****************************************************************************/
